import http from '@/utils/http'
import router from '@/router/router'
export default {
    getGoodOrderList(context){
        return http.post('/order/admin/goodsList',{})
            .then((res) => {
                if(res.status == 0 && res.code == "1000002"){
                    router.push('/login');
                }else{
                    context.commit('setGoodOrderList',res.data);
                }                
            })
            .catch(err => console.log(err));
    },
    getGoodsDetail(context,params){
        return http.post('/order/admin/detail',params)
            .then((res) => {
                if(res.status == 0 && res.code == "1000002"){
                    router.push('/login');
                }else{
                    context.commit('setGoodsDetail',res.data);
                }       
            })
            .catch(err => console.log(err));
    },
    updataGoodsDetail(context,params){
        return http.post('/order/admin/update',params)
            .catch(err => console.log(err));
    }
}